home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume6 / vt100tool / part09 < prev    next >
Encoding:
Internet Message Format  |  1986-11-30  |  44.3 KB

  1. Subject: v06i068:  VT100TOOL for Sun's (vt100tool), Part09/10
  2. Newsgroups: mod.sources
  3. Approved: rs@mirror.UUCP
  4.  
  5. Submitted by: linus!ell (Ed Lafferty)
  6. Mod.sources: Volume 6, Issue 68
  7. Archive-name: vt100tool/Part09
  8.  
  9. [  I generally dislike posting anything other than source code.  In this
  10.    case, however, I'm making an exception because (a) there's no other
  11.    way to do it; and (b) there is apparently a lot of demand for this
  12.    program.  So, I took the object and data files in the fontdir and
  13.    libdir directories and uuencode'd them.  The decode.sh script in the
  14.    toplevel directory will uudecode them and remove the uu.xxx files;
  15.    it lists the files by name, so you can check if you're missing
  16.    something.  This comment will appear at the beginning of each of the
  17.    postings of this program.  --r$  ]
  18.  
  19.  
  20. #!/bin/sh
  21. # This is a shell archive.  Remove anything before this line,
  22. # then unpack it by saving it in a file and typing "sh file".
  23. # Wrapped by rs@mirror.UUCP on Thu Jul 17 00:22:14 EDT 1986
  24. # Contents:  src/ttyvt100.c src/vt100keys.c MANIFEST
  25.  
  26. echo x - src/ttyvt100.c
  27. sed 's/^XX//' > "src/ttyvt100.c" <<'@//E*O*F src/ttyvt100.c//'
  28. XX#ifndef lint
  29. XXstatic    char sccsid[] = "@(#)ttyvt100.c 1.16 86/06/25 Copyr 1985 MITRE Corp.";
  30. XX#endif
  31.  
  32. XX/*
  33. XX * Copyright (c) 1985 by MITRE Corporation
  34. XX */
  35.  
  36. XX#include <stdio.h>
  37. XX#include <pixrect/pixrect_hs.h>
  38. XX#include <sunwindow/window_hs.h>
  39. XX#include <signal.h>
  40. XX#include <ctype.h>
  41.  
  42. XX#include <sys/ioctl.h>
  43. XX#include <sun/fbio.h>
  44. XX#include <sundev/kbio.h>
  45. XX#include <sundev/kbd.h>
  46.  
  47. XX#undef DEBUG
  48. XXint debug =  0;            /* to enable any debugging you must */
  49. XXint debug2 = 0;            /* Define DEBUG and set one of the */
  50. XXint debug1 = 0;            /* debug flags                     */
  51. XXint debug4 = 0;
  52. XXint debug3 = 0;
  53. XXint debug5 = 0;
  54. XXint debug6 = 0;
  55. XXint debug7 = 0;
  56. XXint debug8 = 0;
  57. XX#include <sunwindow/cms_grays.h>
  58. XX#include "ttysw_impl.h"
  59. XX#include "ttyvt100.h"
  60. XX#include "charimage.h"
  61. XX#include "charscreen.h"
  62. XX#define vanillaChar(c)    ((c >= ' ') && (c <= '~'))
  63. XXchar ansiCharBuf[CHAR_BUF_LEN];
  64. XXextern struct pixwin *csr_pixwin;/* This is the ttysw windowfd */
  65. XXextern struct pixfont *pixfont;        /* This is what csr_init uses ???? */
  66. XXextern int chrwidth;
  67. XXextern int right,top,bottom,left;
  68. XXextern pstring(),bold(),nobold();
  69. XXextern void init_kbd();
  70.  
  71.  
  72. XX/* Logical state of window and program switches */
  73. XXint  graf_norm, bold_norm;
  74. XXint curscol = 0;    /* cursor column */
  75. XXint cursrow = 0;    /* cursor row */
  76. XXint state = ALPHA;    /* ALPHA,VT52, ESCBRKT, ESCBRKTQM, etc, */
  77. XXint state1 = 0;            /* holds EATCHARS flag at last column */
  78. XXint vl = 0;            /* accumulate vt52 first arg */
  79. XXint ac = 0;    /* accumulates last arg in ESCBRKT sequences. 0-->1. */
  80. XXint ac0 = 0;            /* ditto, but next to last arg.  0 ==> 1 */
  81. XXint acinit = 0;            /* initial value of ac (with 0 left alone) */
  82. XXint acinit0 = 0;            /*  ditto for first Pn */
  83. XXint acm[10];            /* array of parameters */
  84. XXint ac_num = 0;            /* number of parms this time */
  85. XXint scroll_top = 0;        /* definition of top of scrolling region */
  86. XXint scroll_bottom = 23;        /* bottom of scrolling region */
  87. XXint fillfunc = 0;        /* 1 -> boldf */
  88. XXint underscore;             /* 1 -> underscore */
  89. XXint report = 0;            /* 1-7 if host asks for something */
  90.  
  91. XX/* dimensions of VT100 window */
  92. XXint vtop = 0;            /* top row of vt100 window  */
  93. XXint vbottom = 23;        /* bottom row of vt100 window */
  94. XXint vleft = 0;            /* left column of vt100 window  */
  95. XXint vright = 79;        /* right column of regular vt100 window */
  96. XXint tabArray[MAX_SCREEN_WIDTH]; /* array for setting tabs */
  97.  
  98. XX/* VT100 mode variables */
  99. XXint origin_mode = 0;        /* 0 == reset (screen upper left corner) */
  100. XX                                /* 1 == set (upper -left within margins) */
  101. XXint newline = 0;        /* also used by ttysw_main */
  102. XXint local = 0;            /* 1 = local, 0 = online */
  103. XXint cursor;            /* 0 -> NOCURSOR, 1 -> UNDERCURSOR, */
  104. XX                /* 2 -> BLOCKCURSOR */
  105. XXint curs_key = 0;        /*  ANSI cursor key mode [ or O*/
  106. XXchar answer_message[31];    /* holds the answerback message */
  107. XXint repeat = 0;            /* not implemented */
  108. XXint interlace = 0;        /* not implemented */
  109. XXint vt52mode = 0;        /* emulate a vt52 display */
  110. XXint appl_key_ansi = 0;        /* ANSI application keypad mode */
  111. XXint wrap = 0;            /* wrap at margin mode */
  112. XXint big_screen = 0;        /* 132 col mode */
  113. XXint smooth_scroll = 0;        /* not implemented */
  114.  
  115. XXint rev_screen = 0;        /* reverse initial setup BOW or WOB */
  116. XXint alt_keypad_52 = 0;        /* vt52 keypad mode */
  117. XXint half_chrwidth = 5;    /* for 132 col mode */
  118. XXint full_chrwidth = 8;    /* for 80 col mode */
  119. XXint twice_chrwidth = 16;    /* for 40 col modes */
  120. XXint twelve_tenths_chrwidth = 10; /* for 66 col mode */
  121. XXint  g0,g1;        /* to keep character set modes */
  122. XXint  activeCharset = G0;    /* graf or asc */
  123. XXint graph_52 = 0;    /* graphics vt52 mode flag */
  124. XXchar charStr[2] = "c";        /* for writing a single character in vright */
  125. XXchar *charNext;
  126. XXchar *charBufMax;
  127. XXint curscolStart;
  128.  
  129. XX/* we will keep a font designator for each character  */
  130. XX/* so the repair routine will work. Also, need it for rewrite() */
  131. XX 
  132. XX/*
  133. XX * Interpret a string of characters of length <len>.  Stash and restore
  134. XX * the cursor indicator.
  135. XX *
  136. XX * Note that characters with the high bit set will not be recognized.
  137. XX * This is good, for it reserves them for ASCII-8 X3.64 implementation.
  138. XX * It just means all sources of chars which might come here must mask
  139. XX * parity if necessary.
  140. XX *
  141. XX */
  142. XXansiinit()
  143. XX{
  144. XX    int i;
  145. XX    underscore = 0;
  146. XX    curscol = vleft;
  147. XX    cursrow = vtop;
  148. XX/*    setupfullgraycolormap(); */
  149. XX    for (i = 0; i < MAX_SCREEN_WIDTH; i++) tabArray[i] = 0;
  150. XX    for (i = 0; i < MAX_SCREEN_WIDTH; i = i + 8)  tabArray[i]=1;
  151.  
  152. XX    g0 = ASC;
  153. XX    g1 = GRAPH;
  154. XX#ifdef DEBUG
  155. XX    if (debug) printf( "to imageinit...\n");
  156. XX#endif DEBUG
  157. XX    imageinit();
  158. XX    init_kbd();
  159. XX    set_font(5);
  160. XX    return(1);
  161. XX}
  162.  
  163.  
  164. XX/* compatibility kludge */
  165. XXgfxstring(addr, len)
  166. XX    char *addr;
  167. XX    int len;
  168. XX{
  169. XX    extern struct ttysubwindow *_ttysw;
  170. XX    if(len ==1 && *addr == '\014') /* map a ^L into vt100 clear */
  171. XX      {
  172. XX        addr = "\033[2J";
  173. XX        len = 4;
  174. XX      }
  175. XX    ttysw_output(_ttysw, addr, len);
  176. XX}
  177.  
  178. XXttysw_output(ttysw, addr, len0)
  179. XX    struct ttysubwindow *ttysw;
  180. XX    register char *addr;
  181. XX    int len0;
  182. XX{
  183. XX    register char c;
  184. XX    int i;
  185. XX    register int len;
  186. XX    char buffer[30];    /* put string to send back to host here */
  187. XX    char string[30];
  188. XX    removeCursor();
  189. XX    for (len = len0; !ttysw->ttysw_frozen && len > 0; len--) {
  190.  
  191. XX                /* this is the main loop */
  192. XX    c = *addr++;        /* Fetch next char from string */
  193. XX                /*  and bump pointer */
  194. XX    switch(state){
  195.  
  196. XX    case ALPHA:
  197.  
  198. XX        ac = 0;
  199. XX        acinit = 0;
  200. XX        acinit0 = 0;
  201. XX        ac0 = 0;
  202. XX        ac_num = 0;
  203. XX        for (i=0; i<9; i++,acm[i]=0); /* clear parm array */
  204.  
  205. XX        switch (c) {    /* Do control characters first */
  206. XX                   case '\000' :   break; /* null character */
  207. XX            case '\005' :   answerback();        break;
  208. XX            case CTRL(G):    blinkscreen();        break;
  209. XX            case CTRL(H):    pos(curscol-1,cursrow);
  210. XX#ifdef DEBUG
  211. XX                    if(debug)printf("backspace\n");
  212. XX#endif DEBUG
  213. XX                    break;
  214. XX            case CTRL(I):    
  215. XX                    for (i = curscol+1; i <= vright; i++){
  216. XX                      if (tabArray[i])
  217. XX                        {
  218. XX                          pos(i,cursrow);
  219. XX                          break;
  220. XX                        }
  221. XX                    }
  222. XX                    if(i >= vright)
  223. XX                      pos(vright, cursrow); 
  224. XX                    break;
  225. XX                
  226. XX            case CTRL(J):    /* linefeed */
  227. XX            case CTRL(K):   /* VT interpret as LF */
  228. XX            case CTRL(L):   /* FF   "        " "  */ 
  229. XX                    Index();
  230. XX                    break;
  231.  
  232. XX            case CTRL(M):    
  233. XX                    if(newline)
  234. XX                      {
  235. XX                        pos( 0,cursrow);
  236. XX                        Index();
  237. XX                      }
  238. XX                    else pos( 0, cursrow);
  239. XX                    break;
  240. XX            case CTRL(N):   G1_select();
  241. XX                    break;
  242. XX            case CTRL(O):   G0_select();
  243. XX                    break;
  244. XX            case '\033':    state = ESCAPE;
  245. XX                    break;
  246.  
  247. XX                            
  248. XX            default:   /* c is likely a real alpha character */
  249. XX                    if (c < 32) break; /* guess not! */
  250. XX                    if(curscol > vright) /* means we have written into last column */
  251. XX                      {
  252. XX                        switch (wrap)
  253. XX                          {
  254. XX                          case 1:
  255. XX                        curscol = 0;
  256. XX                        pos(curscol,cursrow);
  257. XX                        Index();
  258. XX                        break;
  259. XX                          case 0:                   /* eat the character */
  260. XX                        charStr[0] = c;
  261. XX                        writePartialLine(charStr,vright);
  262. XX                        reflections[cursrow][vright] =  marks[cursrow] + (fillfunc<<8);
  263. XX                        goto loopback;
  264. XX                          }
  265. XX                      }
  266. XX                        
  267. XX                        /* and now handle the normal case "curscol not vright" */
  268. XX                    curscolStart = curscol;    /* initialize for loop */
  269. XX                    charNext = &ansiCharBuf[0];
  270. XX                    *charNext = c; /* put character into output stream */
  271. XX                    charNext++;       /* and bump stream pointer */
  272. XX                    marks[cursrow] |= BUSY;
  273. XX                    reflections[cursrow][curscol] =  marks[cursrow] + (fillfunc<<8);
  274. XX                    curscol++;   /* and bump column  */
  275. XX                    *charNext = '\0';
  276. XX                    writePartialLine(&ansiCharBuf[0], curscolStart); /* and write to screen  */
  277. XX                    break;              
  278. XX                      }
  279. XX        break;
  280.  
  281. XX    case ESCAPELPRN:
  282. XX        switch (c){
  283. XX        case 'A': g0 = UK;
  284. XX              grafon();
  285. XX              if(activeCharset == G0) set_font(5);
  286. XX              break;
  287. XX              
  288. XX        case '1':
  289. XX        case '2':
  290.  
  291. XX        case 'B': g0 = ASC;
  292. XX              grafon();
  293. XX              if(activeCharset == G0) set_font(5);
  294. XX              break;
  295. XX        case '0': g0 = GRAPH;
  296. XX              grafon();
  297. XX              if(activeCharset == G0) set_font(5);
  298. XX              break;
  299. XX        default:  break;
  300. XX            }
  301. XX        state = ALPHA;
  302. XX        break;
  303. XX       case ESCAPERPRN:
  304. XX        switch (c){
  305. XX        case 'A': g1 = UK;
  306. XX              grafon();
  307. XX              if(activeCharset == G1) set_font(5);
  308. XX              break;
  309. XX        case '1':
  310. XX        case '2':
  311. XX        case 'B': g1 = ASC;
  312. XX              grafon();
  313. XX              if(activeCharset == G1) set_font(5);
  314. XX              break;
  315. XX        case '0': g1 = GRAPH;
  316. XX              grafon();
  317. XX              if(activeCharset == G1) set_font(5);
  318. XX              break;
  319. XX        default:  break;
  320. XX            }
  321. XX        state = ALPHA;
  322. XX        break;
  323. XX        case ESCAPESHARP:
  324. XX        switch (c){
  325. XX        case '8': Escreen();
  326. XX              break;
  327. XX        case '3': mark_top(cursrow);
  328. XX              break;
  329. XX              
  330. XX        case '4': mark_bottom(cursrow);
  331. XX              break;
  332. XX        case '5': clear_width(cursrow);
  333. XX              break;
  334. XX        case '6': mark_wide(cursrow);
  335. XX              break;
  336. XX        default:  break;
  337. XX            }
  338. XX        state = ALPHA;
  339. XX        break;
  340. XX                    
  341.  
  342. XX    case ESCBRKT:        /* esc[   accumulate parms */
  343. XX    case ESCBRKTQM:        /* same logic for esc[? */
  344. XX        if ('0' <= c && c <= '9') {
  345. XX           ac = ((char)ac)*10 + c - '0'; /* char for inline muls */
  346. XX           break;
  347. XX        } else if (c == ';') {
  348. XX            
  349. XX            acm[ac_num] = ac;
  350. XX            ac_num++;
  351. XX            ac0 = ac; ac = 0;    /* for compat up */
  352. XX            break;
  353. XX        } else {
  354. XX          if(c != '?'){
  355. XX            acinit = ac;        /* got a alpha */
  356. XX            acinit0 = ac0;              /* default both Pns */
  357. XX            acm[ac_num] = ac;
  358. XX            ac_num++;
  359. XX            if(ac0 == 0 && ac != 0 && ac_num == 1)
  360. XX              {
  361. XX            ac0 = ac; /* if only one then it isthe first */
  362. XX            ac = 0;
  363. XX              }
  364. XX            if(ac0 == 0) ac0 = 1; /* default is 1 not 0 */
  365. XX            if(ac ==0) ac = 1;
  366. XX#ifdef DEBUG
  367. XX    if(debug) printf("acs %d %d %d %d\n",acinit,ac0,ac,ac_num);
  368. XX#endif DEBUG
  369. XX          }
  370. XX   if (state == ESCBRKT){
  371. XX#ifdef DEBUG
  372. XX           if(debug) printf("in CSI %c sequence\n",c);
  373. XX#endif DEBUG
  374. XX        switch ( c ) {
  375. XX            case 'A':    pos(curscol,cursrow-ac0);     break;
  376. XX            case 'B':    pos(curscol,cursrow+ac0);     break;
  377. XX            case 'C':    pos(curscol+ac0,cursrow);     break;
  378. XX            case 'D':    pos(curscol-ac0,cursrow);     break;
  379. XX            case 'f':
  380. XX            case 'H':    abs_pos(ac-1,ac0-1);
  381. XX                    break;
  382. XX            case 'J':
  383. XX             switch(acinit){
  384. XX                 case 0:    cleol(cursrow);
  385. XX                    del_lines(cursrow+1,vbottom);
  386. XX                    clearMarks(cursrow+1,vbottom);
  387. XX                    set_font(5);
  388. XX                    break;
  389. XX                case 1: del_char(vleft,curscol, cursrow);
  390. XX                    del_lines(vtop,cursrow-1);
  391. XX                    clearMarks(vtop,cursrow-1);
  392. XX                    set_font(5);
  393. XX                    break;
  394. XX                case 2:
  395. XX                         del_lines(vtop,vbottom);
  396. XX                    clearMarks(vtop,vbottom);
  397. XX                    set_font(5);
  398. XX                    break;
  399. XX                }
  400. XX                break;
  401. XX            case 'K':
  402. XX                 switch(acinit){
  403. XX                     case 0:
  404. XX                   cleol(cursrow);
  405. XX                   break;
  406. XX                case 1:
  407. XX                   del_char( vleft, curscol,cursrow);
  408. XX                   break;
  409. XX                case 2:
  410. XX                   del_char(vleft,curscol,cursrow);
  411. XX                   cleol(cursrow);
  412. XX                   break;
  413. XX                   }
  414. XX                    break;
  415. XX              case '?': state = ESCBRKTQM;
  416. XX                    break;
  417. XX/* for now just bold and nobold */
  418. XX              case 'm': /* attributes on/off */
  419. XX                if(ac_num == 0)
  420. XX                  {
  421. XX                    acm[0] = acinit;
  422. XX                    ac_num++;
  423. XX                  }
  424. XX                for( i = 0; i < ac_num; i++)
  425. XX                  {
  426. XX                    switch(acm[i]){
  427. XX                    case 0:   All_off();
  428. XX                          break;
  429. XX                    case 1:   Bold_on();
  430. XX                          break;
  431. XX                    case 4:   Under_on();
  432. XX                          break;
  433. XX                    case 5:   Blink_on();
  434. XX                          break;
  435. XX                    case 7:   Reverse_on();
  436. XX                          break;
  437. XX                        }
  438. XX                  }
  439. XX#ifdef DEBUG                
  440. XXif(debug4) printf("attributes %d %d %d %d %d\n", acm[0],acm[1],acm[2],acm[3],acm[4]);                    
  441. XX#endif DEBUG
  442. XX                break;
  443. XX/* reports coming up */                        
  444. XX            case 'c':    /*report what are you? */
  445. XX                    ttysw_input(_ttysw,"\033[?1;0c",7);
  446. XX                    break;
  447. XX/* tabs  clear */
  448. XX            case 'g':    if(acinit == 0 ) {
  449. XX                      tabArray[curscol] = 0;
  450. XX                      break;}
  451. XX                    if(acinit == 3){
  452. XX                                        for(i = 0; i<= MAX_SCREEN_WIDTH-1;i++)
  453. XX                        tabArray[i] = 0;}
  454. XX                      break;
  455. XX/* line feed mode set */
  456. XX            case 'h':    if(acinit == 20) newline = 1;
  457. XX                                    break;
  458. XX/* line feed node reset */
  459. XX            case 'l':    if(acinit == 20) newline = 0;
  460. XX                                    break;
  461. XX/* status requests from host */
  462. XX                        case 'n':    if(acinit == 5)
  463. XX                             ttysw_input(_ttysw,"\033[0n",4);
  464. XX                
  465. XX                                    if(acinit == 6)
  466. XX                      {
  467. XX                sprintf(string,"\033[%u;%uR",cursrow+1,curscol+1);
  468. XX                ttysw_input(_ttysw,string,strlen(string));
  469. XX              }
  470. XX                                    break;
  471. XX/* define scroll region for indexing */
  472. XX            case 'r':    set_scroll_region(); break;
  473. XX/* report terminal parameters */
  474. XX            case 'x':    if(acinit == 0)
  475. XX              ttysw_input(_ttysw,"\033[2;1;1;112;112;1;0x",20);
  476. XX                    if(acinit == 1)
  477. XX              ttysw_input(_ttysw,"\033[3;1;1;112;112;1;0x", 20);          
  478. XX                    break;
  479. XX            case 'q':    /* led business - ignore */    break;
  480.  
  481. XX            }    /* end of ESCBRKT switch */
  482. XX              if(state == ESCBRKT)  state = ALPHA;
  483. XX        ac = 0;
  484. XX        ac0 = 0;
  485. XX        acinit = 0;
  486. XX        acinit0 = 0;
  487. XX        break;
  488. XX        }        /* not  ESCBRKT must be [? */
  489. XX               
  490. XXif(state == ESCBRKTQM){        /* must be esc[? */
  491. XX#ifdef DEBUG
  492. XX            if(debug)printf("esc-[? %c\n",c);
  493. XX#endif DEBUG
  494. XX        switch (c){
  495. XX            case 'h':
  496. XX            switch(acinit){
  497. XX                case 1:    curs_key = 1; break;
  498. XX                case 3:    big_screen = 1;
  499. XX                    vright = 131;
  500. XX                    del_lines(vtop,vbottom);
  501. XX                    clearMarks(vtop,vbottom);
  502. XX                    ac_num = 0;
  503. XX                    scroll_top = vtop;
  504. XX                    scroll_bottom = vbottom;
  505. XX                    pos(0,0);
  506. XX                    set_font(5);
  507. XX                    break;
  508. XX                case 4:    smooth_scroll=1;
  509. XX                    break;
  510. XX                    
  511. XX                case 5:    if(rev_screen==0){
  512. XX                            rev_screen = 1;
  513. XX                    pblack_background();
  514. XX                      }
  515. XX                    break;
  516. XX                case 6:    origin_mode=1;    
  517. XX                        pos(vleft,scroll_top);
  518. XX                    break;
  519. XX                case 7:    wrap = 1;    break;
  520. XX                case 8:    repeat = 1;    break;
  521. XX                case 9:    interlace=1;    break;
  522. XX                default: break;
  523. XX                }
  524. XX            state = ALPHA;
  525. XX                break;
  526. XX            case 'l':
  527. XX                switch(acinit){
  528. XX                case 1:    curs_key = 0;    break;
  529. XX                            case 2:     vt52mode = 1;
  530. XX                    wrap = 1;
  531. XX                    scroll_top = vtop;
  532. XX                    scroll_bottom = vbottom;
  533. XX                    break;
  534. XX                case 3:    big_screen=0;
  535. XX                    vright = 79;
  536. XX                    clearMarks(vtop,vbottom);
  537. XX                    del_lines(vtop,vbottom);
  538. XX                    ac_num = 0;
  539. XX                    scroll_top = vtop;
  540. XX                    scroll_bottom = vbottom;
  541. XX                    pos(0,0);
  542. XX                    set_font(5);
  543. XX                    break;
  544. XX                case 4:    smooth_scroll=0;
  545. XX                    break;
  546. XX                case 5:    if(rev_screen==1){
  547. XX                             rev_screen = 0;
  548. XX                     pwhite_background();
  549. XX                       }
  550. XX                    break;
  551. XX                case 6:    origin_mode=0;    
  552. XX                        pos(vleft,vtop);
  553. XX                    break;
  554. XX                case 7:    wrap = 0;    break;
  555. XX                case 8:    repeat = 0;    break;
  556. XX                case 9:    interlace = 0;    break;
  557. XX                default:    break;
  558. XX                      }
  559. XX            state = ALPHA;
  560. XX            break;
  561. XX                default:     /* esc[? something unknown? */            
  562. XX            state = ALPHA;
  563. XX                break;
  564. XX            }        /* end of esc[? switch */
  565. XX            state = ALPHA;
  566. XX        }            /* end of esc[? conditional */
  567. XX      }                /* ends esc[ and esc[? section */
  568. XX        ac = 0;
  569. XX        ac0 = 0;
  570. XX        acinit = 0;
  571. XX        acinit0 = 0;
  572.  
  573. XX        state = ALPHA;    /* following the ansi sequence, return to */
  574. XX        break;        /* out of state switch */
  575.  
  576.  
  577. XX          case ESC52Y:    /* gather next 2 chars */
  578. XX        if(vl) {
  579. XX          pos( c - '\040',vl - '\040');
  580. XX#ifdef DEBUG
  581. XX          if(debug1)printf("vt52 position %d %d\n",vl-'\40',c-'\40');
  582. XX#endif DEBUG
  583. XX          vl = 0;
  584. XX          state = ALPHA;
  585. XX          break;
  586. XX        }
  587. XX        else {
  588. XX          vl = c;
  589. XX          break;
  590. XX        }
  591. XX        break;
  592.  
  593. XX          case ESCAPE:    
  594. XX#ifdef DEBUG
  595. XX            if(debug)printf("escape-%c\n",c);
  596. XX#endif DEBUG
  597. XX        if(vt52mode) {
  598. XX                     scroll_top = vtop;
  599. XX                 scroll_bottom = vbottom;
  600. XX          switch (c) {
  601. XX          case 'A':  pos(curscol,--cursrow); break;
  602. XX                  case 'B':  pos(curscol,++cursrow); break;
  603. XX          case 'C':  pos(++curscol,cursrow); break;
  604. XX          case 'D':  pos(--curscol,cursrow); break;
  605. XX                  case 'F':  graph_52 = 1;           break;
  606. XX          case 'G':  graph_52 = 0;           break;
  607. XX          case 'H':  pos(0,0);               break;
  608. XX          case 'I':  Rindex();               break;
  609. XX                  case 'J':  cleol(cursrow);
  610. XX                 del_lines(cursrow+1,vbottom);
  611. XX                 break;
  612. XX                  case 'K':  cleol(cursrow);
  613. XX                 break;
  614. XX          case 'Y':  state = ESC52Y;
  615. XX                 vl = 0;
  616. XX                 break;
  617. XX                  case 'Z':  ttysw_input(_ttysw,"\033/Z",3);
  618. XX                 break;
  619. XX                  case '<':  vt52mode = 0;
  620. XX                 break;
  621. XX                  case '>':  alt_keypad_52 = 0;
  622. XX                 break;
  623. XX                  case '=':  alt_keypad_52 = 1;
  624. XX                   break;
  625. XX                  case '1':  graph_52 = 1;
  626. XX                 break;
  627. XX                  case '2':  graph_52 = 0;
  628. XX                 break;
  629. XX               }
  630. XX          if (state == ESCAPE) state = ALPHA;
  631. XX          break;
  632. XX        }
  633. XX        else
  634.  
  635. XX        switch (c) { 
  636. XX            /* detect esc left bracket */
  637. XX            case '[':    
  638. XX                    state = ESCBRKT;
  639. XX                    break;
  640.  
  641. XX            case 'D':       Index();        break;
  642. XX            case 'E':    pos(0,cursrow);
  643. XX                    Index();
  644. XX                                break;
  645. XX            case 'H':    tabArray[curscol] = 1;
  646. XX#ifdef DEBUG
  647. XX                if(debug)printf("tab set at %d\n",curscol);
  648. XX#endif DEBUG
  649. XX                                break;
  650. XX            case 'M':    Rindex();        break;
  651. XX            case 'Z':       ttysw_input(_ttysw,"\033[?1;0c",7);
  652. XX                    break;
  653. XX            case '7':    Save_cursor();        break;
  654. XX            case '8':    Restore_cursor();    break;
  655. XX            case '(':     /* G0 char set designator */
  656. XX                state = ESCAPELPRN;
  657. XX                    break;
  658.  
  659. XX            case ')':  /* G1 char set designator */
  660. XX                    state = ESCAPERPRN;    
  661. XX                    break;
  662. XX                    
  663. XX            case '#':  /*  large char controls */
  664. XX                     state = ESCAPESHARP;
  665. XX                    break;
  666.  
  667. XX            case '1':    /* set graphics option */
  668. XX                    break;
  669. XX                    
  670. XX            
  671. XX            case '2':    /* graphics off */
  672. XX                    break;
  673. XX                    
  674. XX            case '=':    appl_key_ansi = 1;
  675. XX                    break;
  676. XX                    
  677. XX            case '>':    appl_key_ansi = 0;
  678. XX                    break;
  679. XX                    
  680. XX            case 'c':    /* reset power up */
  681. XX                    reset();
  682. XX                    break;
  683. XX                    
  684. XX                    
  685.  
  686. XX    /* By default, ignore the character after the ESC */
  687. XX            default:    state = ALPHA;
  688. XX                    break;
  689. XX        }        /* end plain escape sequence */
  690. XX        ac = 0;
  691. XX        ac0 = 0;
  692. XX        acinit = 0;
  693. XX        acinit0 = 0;
  694. XX        if(state == ESCAPE) state = ALPHA;
  695. XX        break;
  696. XX          
  697. XX          default:        /* for state switch */
  698. XX                /* don't think we ever get here */
  699. XX            state = ALPHA;
  700. XX            cursor = BLOCKCURSOR;
  701. XX            break;
  702. XX          }            /* end of state switch */
  703. XX      loopback: continue;
  704.  
  705. XX      }                /* end of while loop */
  706. XX                    /* get next character from input */
  707. XX/* Finished all input. If we have been asked for a  report return */
  708. XX/* appropriate message as function value (hope not much has followed) */
  709. XX/* EndOuterLoop: */
  710. XX    drawCursor( cursrow, curscol );
  711. XX    return(len0);
  712.  
  713. XX}
  714.  
  715.  
  716. XXpos(col, row)
  717. XX    int col, row;
  718. XX{
  719. XX  int orow;
  720. XX    if (col <= vleft)
  721. XX        col = vleft;
  722. XX    if (col >= vright)
  723. XX        col = vright;
  724. XX            /* mimic vt100 scrolling region anomaly */
  725. XX    if (row <= scroll_top && cursrow >=  scroll_top)
  726. XX        row = scroll_top;
  727. XX    if (row >=scroll_bottom && cursrow <=  scroll_bottom)
  728. XX        row = scroll_bottom;
  729. XX    orow = cursrow;
  730. XX#ifdef DEBUG
  731. XX  if(row < 0) trap();
  732. XX  if(debug7) if (col == 0) printf("POS %d: %s\n",row, image[row]);
  733. XX#endif
  734. XX  if(row < 0)row = 0;
  735.  
  736. XX    cursrow = row;
  737. XX    curscol = col;
  738. XX    vpos(row, col);     /* assume 0,0 upper left for SunW */
  739. XX    check_marks(row,orow);
  740. XX}
  741.  
  742.  
  743.  
  744.  
  745. XXset_scroll_region()
  746. XX{
  747. XX#ifdef DEBUG
  748. XXif(debug3) printf("entering set_scroll_region %d %d %d\n", acinit, ac, ac0);
  749. XX#endif DEBUG
  750. XXif (ac_num == 0 || ac_num == 1 ||(ac_num == 2 && ac == ac0 && ac == 1)) {
  751. XX  
  752. XX/* default :: reset to whole screen */
  753. XX    scroll_top = vtop;
  754. XX    scroll_bottom = vbottom;
  755. XX    pos(0,0);
  756. XX    return; 
  757. XX     }
  758. XXelse                /* set scroll region from pars */
  759. XXif(ac > ac0) {
  760. XX    scroll_top = ac0-1;    /* scroll region start */
  761. XX    scroll_bottom = ac-1;    /*  "       "    end */
  762. XX    pos( 0,origin_mode?scroll_top:0);
  763. XX    }
  764. XX#ifdef DEBUG
  765. XXif (debug3) printf("scroll region %d  %d", scroll_top, scroll_bottom);
  766. XX#endif DEBUG
  767. XX}
  768.  
  769. XXIndex()
  770. XX{
  771.  
  772. XX/* if not at bottom of region, then just move down one line */
  773. XX#ifdef DEBUG
  774. XX    if(debug)printf("Index called %d %d\n",curscol,cursrow);
  775. XX#endif DEBUG
  776. XX    if (cursrow != scroll_bottom) {
  777. XX        pos(curscol,cursrow+1);
  778. XX    return;
  779. XX    }
  780. XX    if (cursrow == scroll_bottom) {
  781. XX      scroll_up();
  782. XX      shiftMarksUp();
  783. XX      check_marks(cursrow,cursrow-1);
  784. XX    }
  785. XX}
  786.  
  787. XXRindex()
  788. XX{
  789. XX#ifdef DEBUG
  790. XX    if(debug)printf("Rindex called %d %d\n",curscol,cursrow);
  791. XX#endif DEBUG
  792. XX/* if not at top of scroll region, then just move up a line */
  793. XX    if (cursrow !=  scroll_top) {
  794. XX        pos(curscol,cursrow-1);
  795. XX    return;
  796. XX    }
  797. XX    if (cursrow == scroll_top) {
  798. XX      scroll_down();
  799. XX      shiftMarksDown();
  800. XX      check_marks(cursrow,cursrow+1);
  801. XX    }
  802.  
  803. XX}
  804.  
  805. XX/* Scroll up one line at the cursor position -- happens on LF at
  806. XXbottom of the screen or when ESC-E or D commands step at bottom 
  807. XXmargin -- also linefeed at bottom margin if margins set */
  808. XXscroll_up()
  809. XX{
  810. XX  int otop = top;
  811. XX  int obottom = bottom;
  812. XX  top = scroll_top;
  813. XX  bottom = scroll_bottom;
  814. XX  scroll1up(top,bottom);
  815. XX  top = otop;
  816. XX  bottom = obottom;
  817.  
  818. XX}
  819.  
  820. XXscroll_down()            /* Same as up except that we have to  */
  821. XX{                /* get rid of lines off bottom of screen */
  822. XX  int otop = top;
  823. XX  int obottom = bottom;
  824. XX  top = scroll_top;
  825. XX  bottom = scroll_bottom;
  826. XX  scroll1dn(top, bottom);
  827. XX  top = otop;
  828. XX  bottom = obottom;
  829.  
  830. XX}
  831.  
  832. XXint ocursrow, ocurscol, obold, ocharset,og0,og1;
  833. XX    
  834. XXSave_cursor()
  835. XX{
  836. XX    ocursrow = cursrow;
  837. XX    ocurscol = curscol;
  838. XX    obold = fillfunc;
  839. XX    ocharset = activeCharset;
  840. XX    og0 = g0;
  841. XX    og1 = g1;
  842. XX    
  843. XX}
  844.  
  845. XXRestore_cursor()
  846. XX{
  847. XX    cursrow = ocursrow;
  848. XX    curscol = ocurscol;
  849. XX    fillfunc = obold;
  850. XX    if(fillfunc & BOLD) Bold_on();
  851. XX    if(fillfunc & UNDER) Under_on();
  852. XX    if(fillfunc & REVERSE)  Reverse_on();
  853. XX    activeCharset = ocharset;
  854. XX    grafon();
  855. XX    g0 = og0;
  856. XX    g1 = og1;
  857. XX    set_font(5);
  858. XX    
  859. XX}
  860.  
  861. XXchar * estring = "EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE";
  862.  
  863.  
  864. XXEscreen()
  865. XX{
  866. XX    int i = 0;
  867. XX    newline = 0;
  868. XX    origin_mode = 0;
  869. XX    wrap = 1;
  870. XX    curscol = 0;
  871. XX    cursrow = 0;
  872. XX    scroll_top = 0;
  873. XX    scroll_bottom = 23;
  874. XX    del_lines(vtop,vbottom);
  875. XX    clearMarks(vtop,vbottom);
  876. XX    estring[vright+1] = '\0';
  877. XX    while (i <= vbottom){
  878. XX          pos(0,i);
  879. XX      writePartialLine(estring,0);
  880. XX      i++;
  881. XX      }
  882. XX    estring[vright+1] = 'E';
  883. XX    pos(0,0);
  884. XX  }
  885. XX  
  886.  
  887.  
  888. XXanswerback()
  889. XX{
  890. XX  ttysw_input(_ttysw,answer_message,strlen(answer_message));
  891. XX}
  892.  
  893.  
  894. XXreset()
  895. XX{
  896. XX  newline = 0;
  897. XX  wrap = 1;
  898. XX  origin_mode = 0;
  899. XX  big_screen = 0;
  900. XX  curscol = 0;
  901. XX  cursrow = 0;
  902. XX  fillfunc = 0;
  903. XX  scroll_top = 0;
  904. XX  scroll_bottom = 23;
  905. XX  del_lines(vtop,vbottom);
  906. XX  clearMarks(vtop,vbottom);
  907. XX  vt52mode = 0;
  908. XX  set_font(5);
  909. XX  pos(curscol,cursrow);
  910. XX}
  911. XXchar* blanks = "                                                                                                                                       ";
  912. XXdel_lines(from,to)
  913. XXint from,to;
  914. XX{
  915. XX  int i, inverse;
  916. XX  int savec = curscol;
  917. XX  int savel = cursrow;
  918. XX#ifdef DEBUG
  919. XX  if(debug) printf("deleting from %d to %d\n",from, to);
  920. XX#endif DEBUG
  921. XX  inverse = fillfunc & REVERSE;
  922. XX  nobold();
  923. XX  blanks[vright+1] = '\0';
  924. XX  for(i= from; i<=to; i++)
  925. XX    {
  926. XX     pos(0,i);
  927. XX/*     writePartialLine(blanks,0); */
  928. XX     vsetlinelength(image[i],0);
  929. XX   }
  930. XX  pclearscreen(from, to+1);
  931. XX  blanks[vright +1] = ' ';
  932. XX  if(inverse) bold();
  933. XX  pos(savec,savel);
  934. XX}
  935.  
  936. XXchar buf[MAX_SCREEN_WIDTH];        
  937.  
  938.  
  939. XX/* Writes blanks into line and keeps cursor at original position */
  940.  
  941. XXdel_char(from,to,row)
  942. XXint from,to,row;
  943. XX{
  944. XX  int savec,savel,inverse;
  945. XX  register i = to - from +1;
  946. XX  savec = curscol;
  947. XX  savel = cursrow;
  948. XX  nobold();
  949. XX  cursrow = row;
  950. XX  blanks[i] = '\0';
  951. XX  writePartialLine(blanks, from);
  952. XX  blanks[i] = ' ';
  953. XX  if(fillfunc & REVERSE) bold(); /* restore reverse if set */
  954. XX  pos(savec,savel);        
  955. XX}
  956.  
  957. XXcleol(row)
  958. XXint row;
  959. XX{
  960. XX  int i;
  961. XX  del_char(curscol, vright, row);
  962. XX  vsetlinelength(image[row],curscol);
  963.  
  964. XX}
  965.  
  966.  
  967. XX      
  968.  
  969. XX/*special routine for vt100 abs cursor position  */
  970.  
  971. XXabs_pos(col,row)
  972. XXint row, col;
  973. XX{
  974. XX  int srow;
  975. XX  int orow;
  976. XX  orow = cursrow;
  977. XX  if (origin_mode){
  978. XX    srow = row + scroll_top;
  979. XX    if(srow > scroll_bottom) srow = scroll_bottom;
  980. XX  }
  981. XX  else srow = row;
  982. XX  curscol = col;
  983. XX  cursrow = srow;
  984.  
  985. XX#ifdef DEBUG
  986. XX  if(cursrow < 0 ) trap();
  987. XX  if(debug)printf("moving to col %d, row %d \n",col,srow);
  988. XX#endif DEBUG
  989. XX  vpos(srow,col);
  990. XX  check_marks(cursrow,orow);
  991. XX}
  992.  
  993. XXtrap(){}
  994. XX  
  995. XXpwhite_background()
  996. XX{
  997. XX/*  pw_blackonwhite(csr_pixwin, 0,1); */
  998. XX  pw_writebackground(csr_pixwin, 0 , 0,
  999. XX             winwidthp, winheightp, PIX_NOT(PIX_DST)); 
  1000.  
  1001.  
  1002. XX      }
  1003.  
  1004. XXpblack_background()
  1005. XX{
  1006. XX/*  pw_whiteonblack(csr_pixwin,0,1); */
  1007. XX  pw_writebackground(csr_pixwin, 0, 0,
  1008. XX             winwidthp, winheightp, PIX_NOT(PIX_DST));
  1009. XX}
  1010.  
  1011. XXmark_top(row)            /* top of double height row */
  1012. XXint row;
  1013. XX{
  1014. XX  int i;
  1015. XX  marks[row] &= ~ BOTTOM_F;
  1016. XX  marks[row] |= TOP_F|WIDE_F;
  1017. XX  for (i = 0; i <= 131; i++){
  1018. XX    reflections[row][i] &= ~ BOTTOM_F;
  1019. XX    reflections[row][i] |= TOP_F|WIDE_F ;
  1020. XX  }
  1021. XX  if(length(image[row]) > big_screen ? 66 : 40)
  1022. XX    vsetlinelength(image[row],big_screen ? 66 : 40);
  1023. XX  rewrite(row);
  1024. XX}
  1025.  
  1026.  
  1027. XXmark_bottom(row)        /* bottom of double height row */
  1028. XXint row;
  1029. XX{
  1030. XX  int i;
  1031. XX  marks[row] &= ~ TOP_F;
  1032. XX  marks[row] |= BOTTOM_F|WIDE_F;
  1033. XX  for (i = 0; i <= 131; i++)
  1034. XX    {
  1035. XX      reflections[row][i] &= ~TOP_F;
  1036. XX      reflections[row][i] |= BOTTOM_F|WIDE_F;
  1037. XX    }
  1038. XX  if(length(image[row]) > big_screen ? 66 : 40)
  1039. XX    vsetlinelength(image[row],big_screen ? 66 : 40);
  1040. XX  rewrite(row);
  1041. XX}
  1042.  
  1043.  
  1044. XXclear_width(row)        /* set row to non-widte ype */
  1045. XXint row;
  1046. XX{
  1047. XX  int i;
  1048. XX  marks[row] &= ~(WIDE_F|TOP_F|BOTTOM_F);
  1049. XX  for (i = 0; i <= 131; i++)
  1050. XX    {
  1051. XX      reflections[row][i] &= ~(WIDE_F|TOP_F|BOTTOM_F);
  1052. XX    }
  1053. XX  
  1054. XX  rewrite(row);        
  1055. XX}
  1056.  
  1057.  
  1058. XXmark_wide(row)        /* double width -single height row */
  1059. XXint row;
  1060. XX{
  1061. XX  int i;
  1062. XX  marks[row] &= ~(BOTTOM_F|TOP_F);
  1063. XX  marks[row] |= WIDE_F;
  1064. XX  for (i = 0; i <= 131; i++)
  1065. XX    {
  1066. XX      reflections[row][i] &= ~(BOTTOM_F|TOP_F);
  1067. XX      reflections[row][i] |= WIDE_F;
  1068. XX    }
  1069. XX  if(length(image[row]) > big_screen ? 66 : 40)
  1070. XX    vsetlinelength(image[row],big_screen ? 66 : 40);
  1071. XX  rewrite(row);
  1072. XX}
  1073.  
  1074.  
  1075. XXG0_select()
  1076. XX{
  1077. XX#ifdef DEBUG
  1078. XX  if(debug4) printf("selecting G0 font which is %d\n",G0);
  1079. XX#endif
  1080. XX  activeCharset = G0;
  1081. XX  set_font(5);
  1082. XX  return;
  1083. XX}
  1084.  
  1085. XXG1_select()
  1086. XX{
  1087. XX#ifdef DEBUG
  1088. XX  if(debug4) printf("selecting G1 font which is %d\n", G1);
  1089. XX#endif
  1090. XX  activeCharset = G1;
  1091. XX  set_font(5);
  1092. XX  return;
  1093. XX}
  1094.  
  1095.  
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103. XXshiftMarksUp()            /* LF or Index has dropped top line */
  1104. XX{
  1105. XX  int i,j;            
  1106. XX  for(i = scroll_top; i < scroll_bottom; i++)
  1107. XX    {
  1108. XX      marks[i] = marks[i+1];
  1109. XX      for (j = 0; j < 132; j++) reflections[i][j] = reflections[i+1][j];
  1110. XX    }
  1111. XX  marks[scroll_bottom] = big_screen ? NARROW_F : NORMAL_F;/* New line is 80 or 132 cols */
  1112. XX  for (j = 0 ; j < 132; j++) reflections[scroll_bottom][j] = marks[scroll_bottom];
  1113. XX}
  1114. XX    
  1115. XXshiftMarksDown()    /* scroll down has removed bottom line */
  1116. XX{    
  1117. XX  int i,j;
  1118. XX  for ( i = scroll_bottom; i > scroll_top; i--)
  1119. XX    {
  1120. XX      marks[i] = marks[i-1];
  1121. XX      for ( j = 0; j < 132; j++) reflections[i][j] = reflections[i-1][j];
  1122. XX    }
  1123. XX  marks[scroll_top] = big_screen ? NARROW_F : NORMAL_F;
  1124. XX  for(j = 0; j < 132; j++) reflections[scroll_top][j] = marks[scroll_top];
  1125. XX}
  1126.  
  1127. XXclearMarks(from,to)
  1128. XXint from,to;
  1129. XX{
  1130. XX  int i,j;
  1131. XX  for(i = from; i <= to ; i++)
  1132. XX    {
  1133. XX      marks[i] =big_screen ? NARROW_F : NORMAL_F;
  1134. XX      for (j = 0; j< 132; j++) reflections[i][j] = marks[i];
  1135. XX    }
  1136.  
  1137. XX}
  1138.  
  1139. XX  
  1140. XXAll_off()            /* turn off all attributes */
  1141. XX{
  1142. XX#ifdef DEBUG
  1143. XX  if(debug4) printf("All_off entered\n");
  1144. XX#endif
  1145. XX  fillfunc = 0;
  1146. XX  underscore = 0;
  1147. XX  nobold();
  1148. XX  set_font(5);
  1149. XX}
  1150.  
  1151. XXBold_on()
  1152. XX{
  1153. XX#ifdef DEBUG
  1154. XX  if(debug4) printf("Bold_on entered\n");
  1155. XX#endif
  1156. XX  fillfunc |= BOLD;  
  1157. XX  set_font(5);
  1158.  
  1159. XX}
  1160.  
  1161. XXReverse_on()
  1162. XX{
  1163. XX#ifdef DEBUG
  1164. XX  if(debug4) printf("Reverse_on entered\n");
  1165. XX#endif
  1166. XX  fillfunc |= REVERSE;
  1167. XX  bold();
  1168. XX}
  1169. XXBlink_on()            /* can't figure out how to do this */
  1170. XX{
  1171. XX  fillfunc |= BLINK;
  1172. XX}
  1173.  
  1174. XXUnder_on()
  1175. XX{
  1176. XX  underscore = 1;
  1177. XX  fillfunc |= UNDER;
  1178. XX}
  1179.  
  1180.  
  1181. XXscroll1up(tp,bm)
  1182. XXint tp,bm;
  1183. XX{
  1184. XX  int i;
  1185. XX  char *line;
  1186. XX  swapregions ( tp , tp + 1, bm - tp);
  1187. XX  line = image[bm];
  1188. XX  for(i = 0; i <= right; i++) line[i] = ' ';
  1189. XX  vsetlinelength(image[bm],0);
  1190. XX/*  pcopyscreen(tp+1,tp,bm-tp);  */
  1191. XX  pw_copy(csr_pixwin, col_to_x(vleft), row_to_y(tp), winwidthp,
  1192. XX      row_to_y(bm -tp), PIX_SRC,
  1193. XX      csr_pixwin, col_to_x(vleft), row_to_y(tp + 1));
  1194. XX  pclearline(left,right, bm);
  1195. XX  
  1196. XX}
  1197. XXscroll1dn(tp,bm)
  1198. XXint tp,bm;
  1199. XX{
  1200. XX  int i,k;
  1201. XX  char *line;
  1202. XX  swapnregions(bm, bm - 1,bm - tp);
  1203. XX  line = image[tp];
  1204. XX  for(i = 0; i <= right; i++) line[i] = ' ';
  1205. XX  vsetlinelength(image[tp],0);
  1206. XX/*  pcopyscreen(tp, tp+1, bm-tp);*/
  1207. XX  pw_copy(csr_pixwin, col_to_x(vleft), row_to_y(tp+1), winwidthp,
  1208. XX      row_to_y(bm -tp), PIX_SRC,
  1209. XX      csr_pixwin, col_to_x(vleft), row_to_y(tp));
  1210. XX  
  1211. XX  pclearline(left,right,tp);
  1212. XX}
  1213.  
  1214.  
  1215.  
  1216. XXswapnregions(a, b, n)        /* move block down */
  1217. XX    int a, b, n;
  1218. XX{
  1219. XX    while (n--)
  1220. XX        swap(a--, b--);
  1221. XX}
  1222.  
  1223. XXint
  1224. XXsetupfullgraycolormap()
  1225.  
  1226. XX{
  1227.  
  1228.  
  1229. XX    register u_char    red[CMS_GRAYSSIZE], green[CMS_GRAYSSIZE],
  1230. XX        blue[CMS_GRAYSSIZE]; 
  1231. XX    register i;
  1232.  
  1233. XX    /*
  1234. XX     * Initialize to gray cms.
  1235. XX     */
  1236. XX/*    pw_setcmsname(csr_pixwin, CMS_GRAYS); */
  1237. XX    cms_grayssetup(red,green,blue);
  1238. XX    pw_putcolormap(csr_pixwin, 0, CMS_GRAYSSIZE, red, green, blue);
  1239. XX    return(CMS_GRAYSSIZE);
  1240. XX}
  1241.  
  1242.  
  1243. @//E*O*F src/ttyvt100.c//
  1244. chmod u=r,g=r,o=r src/ttyvt100.c
  1245.  
  1246. echo x - src/vt100keys.c
  1247. sed 's/^XX//' > "src/vt100keys.c" <<'@//E*O*F src/vt100keys.c//'
  1248. XX#ifndef lint
  1249. XXstatic    char sccsid[] = "@(#)vt100keys.c 1.6 86/04/11 Copyr 1985 MITRE Corp";
  1250. XX#endif
  1251.  
  1252. XX/*
  1253. XX * Copyright (c) 1985 by MITRE Corporation
  1254. XX */
  1255.  
  1256. XX#include <stdio.h>
  1257. XX#include <pixrect/pixrect_hs.h>
  1258. XX#include <sunwindow/window_hs.h>
  1259. XX#include <signal.h>
  1260. XX#include <ctype.h>
  1261.  
  1262. XX#include <sys/ioctl.h>
  1263. XX#include <sun/fbio.h>
  1264. XX#include <sundev/kbio.h>
  1265. XX#include <sundev/kbd.h>
  1266. XX#include "ttyvt100.h"
  1267. XX#include "charimage.h"
  1268. XX#include "charscreen.h"
  1269. XXextern int vt52mode, curs_key,alt_keypad_52,appl_key_ansi;
  1270. XX/* This routine takes function keys and converts to vt100 key-strings */
  1271. XX/* These depend on the mode settings: */
  1272. XX/* CURSOR KEYS: */
  1273. XX/* vt52_mode */
  1274. XX/* ANSI mode && curs_key mode */
  1275. XX/* ANSI mode && not curs_key mode */
  1276. XX/* AUXILIARY KEYPAD: */
  1277. XX/* vt52mode && numeric */
  1278. XX/* vt52mode && application */
  1279. XX/* ANSI && numeric */
  1280. XX/* ANSI && application */
  1281. XX/********************************* */
  1282. XXextern int newline;
  1283.  
  1284. XXchar *
  1285. XXtranslate_key(code)
  1286. XXint code;
  1287. XX{
  1288. XX  int flag = 0;
  1289. XX  int flagc = 0;
  1290. XX  /*  Now set up from mode flags: */
  1291. XX  flagc = vt52mode;        /* that's a 1 0r 0 */
  1292.  
  1293. XX#ifdef DEBUG
  1294. XXif(debug2)printf("entered translate with %d\n",code);
  1295. XX#endif DEBUG
  1296.  
  1297. XX  if(!vt52mode)  flagc = 2 + curs_key; /* makes it 2 or 3 */
  1298. XX  if(vt52mode && alt_keypad_52) flag = APPL5;
  1299. XX  if(vt52mode && !alt_keypad_52)flag = NUMER5;
  1300. XX  if(!vt52mode && appl_key_ansi) flag = APPLA;
  1301. XX  if(!vt52mode && !appl_key_ansi) flag = NUMERA;
  1302. XX  switch(code){
  1303. XX    /* Left panel except L1 which */
  1304. XX    /* is the hardware abort control (when combined with "a")*/
  1305. XX  case   KEY_LEFT(2):       
  1306. XX  case   KEY_LEFT(3):       
  1307. XX  case   KEY_LEFT(4):       
  1308. XX  case   KEY_LEFT(5):       
  1309. XX  case   KEY_LEFT(6):       
  1310. XX  case   KEY_LEFT(7): 
  1311. XX  case   KEY_LEFT(8):
  1312. XX  case   KEY_LEFT(9):
  1313. XX  case   KEY_LEFT(10): return("");
  1314.  
  1315. XX    /* right panel but not the cursor keys yet */
  1316. XX    /* we will use all 15 as keypad PF1--15*/
  1317.  
  1318. XX  case   KEY_RIGHT(1): /* PF1 */
  1319. XX          switch(flag){
  1320. XX          case NUMER5: return("\033P");
  1321. XX          case NUMERA: return("\033OP");
  1322. XX          case APPL5:  return("\033P");
  1323. XX          case APPLA:  return("\033OP");
  1324. XX          default:  break;
  1325. XX              }
  1326. XX          return("");
  1327. XX  case   KEY_RIGHT(2): /* PF2 */
  1328. XX          switch(flag){
  1329. XX          case NUMER5: return("\033Q");
  1330. XX          case NUMERA: return("\033OQ");
  1331. XX          case APPL5:  return("\033Q");
  1332. XX          case APPLA:  return("\033OQ");
  1333. XX          default:  break;
  1334. XX              }
  1335. XX          return("");
  1336. XX  case   KEY_RIGHT(3): /* PF3 */
  1337. XX          switch(flag){
  1338. XX          case NUMER5: return("\033R");
  1339. XX          case NUMERA: return("\033OR");
  1340. XX          case APPL5:  return("\033R");
  1341. XX          case APPLA:  return("\033OR");
  1342. XX          default:  break;
  1343. XX              }
  1344. XX          return("");
  1345. XX  case   KEY_RIGHT(4): /*  7  */
  1346. XX          switch(flag){
  1347. XX          case NUMER5: return("7");
  1348. XX          case NUMERA: return("7");
  1349. XX          case APPL5:  return("\033?w");
  1350. XX          case APPLA:  return("\033Ow");
  1351. XX          default:  break;
  1352. XX              }
  1353. XX          return("");
  1354. XX  case   KEY_RIGHT(5): /*  8  */
  1355. XX          switch(flag){
  1356. XX          case NUMER5: return("8");
  1357. XX          case NUMERA: return("8");
  1358. XX          case APPL5:  return("\033?x");
  1359. XX          case APPLA:  return("\033Ox");
  1360. XX          default:  break;
  1361. XX              }
  1362. XX          return("");
  1363. XX  case   KEY_RIGHT(6): /*  9  */
  1364. XX                  switch(flag){
  1365. XX          case NUMER5: return("9");
  1366. XX          case NUMERA: return("9");
  1367. XX          case APPL5:  return("\033?y");
  1368. XX          case APPLA:  return("\033Oy");
  1369. XX          default:  break;
  1370. XX              }
  1371. XX          return("");
  1372.  
  1373. XX  case   KEY_RIGHT(7): /*  4  */
  1374. XX          switch(flag){
  1375. XX          case NUMER5: return("4");
  1376. XX          case NUMERA: return("4");
  1377. XX          case APPL5:  return("\033?t");
  1378. XX          case APPLA:  return("\033Ot");
  1379. XX          default:  break;
  1380. XX              }
  1381. XX          return("");
  1382.  
  1383. XX  case   KEY_RIGHT(8): /*  5  */
  1384. XX          switch(flag){
  1385. XX          case NUMER5: return("5");
  1386. XX          case NUMERA: return("5");
  1387. XX          case APPL5:  return("\033?u");
  1388. XX          case APPLA:  return("\033Ou");
  1389. XX          default:  break;
  1390. XX              }
  1391. XX          return("");
  1392.  
  1393.  
  1394. XX  case   KEY_RIGHT(9): /*  6  */
  1395. XX          switch(flag){
  1396. XX          case NUMER5: return("6");
  1397. XX          case NUMERA: return("6");
  1398. XX          case APPL5:  return("\033?v");
  1399. XX          case APPLA:  return("\033Ov");
  1400. XX          default:  break;
  1401. XX              }
  1402. XX          return("");
  1403.  
  1404. XX  case   KEY_RIGHT(10): /* 1  */
  1405. XX          switch(flag){
  1406. XX          case NUMER5: return("1");
  1407. XX          case NUMERA: return("1");
  1408. XX          case APPL5:  return("\033?q");
  1409. XX          case APPLA:  return("\033Oq");
  1410. XX          default:  break;
  1411. XX              }
  1412. XX          return("");
  1413.  
  1414. XX  case   KEY_RIGHT(11): /* 2  */
  1415. XX          switch(flag){
  1416. XX          case NUMER5: return("2");
  1417. XX          case NUMERA: return("2");
  1418. XX          case APPL5:  return("\033?r");
  1419. XX          case APPLA:  return("\033Or");
  1420. XX          default:  break;
  1421. XX              }
  1422. XX          return("");
  1423.  
  1424. XX  case   KEY_RIGHT(12): /* 3  */
  1425. XX          switch(flag){
  1426. XX          case NUMER5: return("3");
  1427. XX          case NUMERA: return("3");
  1428. XX          case APPL5:  return("\033?s");
  1429. XX          case APPLA:  return("\033Os");
  1430. XX          default:  break;
  1431. XX              }
  1432. XX          return("");
  1433.  
  1434. XX  case   KEY_RIGHT(13): /* 0  */
  1435. XX          switch(flag){
  1436. XX          case NUMER5: return("0");
  1437. XX          case NUMERA: return("0");
  1438. XX          case APPL5:  return("\033?p");
  1439. XX          case APPLA:  return("\033Op");
  1440. XX          default:  break;
  1441. XX              }
  1442. XX          return("");
  1443.  
  1444. XX  case   KEY_RIGHT(14): /* .  */
  1445. XX          switch(flag){
  1446. XX          case NUMER5: return(".");
  1447. XX          case NUMERA: return(".");
  1448. XX          case APPL5:  return("\033?n");
  1449. XX          case APPLA:  return("\033On");
  1450. XX          default:  break;
  1451. XX              }
  1452. XX          return("");
  1453.  
  1454.  
  1455. XX  case   KEY_RIGHT(15): /*ENTER*/
  1456. XX          switch(flag){
  1457. XX          case NUMERA:  
  1458. XX          case NUMER5: if(newline)
  1459. XX                          return("\r\n");
  1460. XX                   else return("\r");
  1461. XX          case APPL5:  return("\033?M");
  1462. XX          case APPLA:  return("\033OM");
  1463. XX          default:  break;
  1464. XX              }
  1465. XX          return("");
  1466.  
  1467. XX    /* Top panel */
  1468. XX  case   KEY_TOP(1):      return("");
  1469. XX  case   KEY_TOP(2):      return("");
  1470. XX  case   KEY_TOP(3): /*  UP   */ 
  1471. XX          switch(flagc){
  1472. XX          case 1: return("\033A");
  1473. XX          case 2: return("\033[A");
  1474. XX          case 3:  return("\033OA");
  1475. XX          default:  break;
  1476. XX              }
  1477. XX          return("");
  1478.  
  1479. XX  case   KEY_TOP(4): /* DOWN  */
  1480. XX          switch(flagc){
  1481. XX          case 1: return("\033B");
  1482. XX          case 2: return("\033[B");
  1483. XX          case 3:  return("\033OB");
  1484. XX          default:  break;
  1485. XX              }
  1486. XX          return("");
  1487.  
  1488. XX  case   KEY_TOP(5): /* LEFT  */
  1489. XX          switch(flagc){
  1490. XX          case 1: return("\033D");
  1491. XX          case 2: return("\033[D");
  1492. XX          case 3:  return("\033OD");
  1493. XX          default:  break;
  1494. XX              }
  1495. XX          return("");
  1496.  
  1497. XX  case   KEY_TOP(6): /* RIGHT */
  1498. XX          switch(flagc){
  1499. XX          case 1: return("\033C");
  1500. XX          case 2: return("\033[C");
  1501. XX          case 3:  return("\033OC");
  1502. XX          default:  break;
  1503. XX              }
  1504. XX          return("");
  1505.  
  1506. XX  case   KEY_TOP(7): /* PF4   */
  1507. XX          switch(flag){
  1508. XX          case NUMER5: return("\033S");
  1509. XX          case NUMERA: return("\033OS");
  1510. XX          case APPL5:  return("\033S");
  1511. XX          case APPLA:  return("\033OS");
  1512. XX          default:  break;
  1513. XX              }
  1514. XX          return("");
  1515.  
  1516. XX  case   KEY_TOP(8): /*-(dash)*/
  1517. XX          switch(flag){
  1518. XX          case NUMER5: return("-");
  1519. XX          case NUMERA: return("-");
  1520. XX          case APPL5:  return("\033?m");
  1521. XX          case APPLA:  return("\033Om");
  1522. XX          default:  break;
  1523. XX              }
  1524. XX          return("");
  1525.  
  1526. XX  case   KEY_TOP(9): /*,comma */
  1527. XX          switch(flag){
  1528. XX          case NUMER5: return(",");
  1529. XX          case NUMERA: return(",");
  1530. XX          case APPL5:  return("\033?l");
  1531. XX          case APPLA:  return("\033Ol");
  1532. XX          default:  break;
  1533. XX              }
  1534. XX          return("");
  1535. XX    default: return("");
  1536. XX          }
  1537. XX}
  1538.  
  1539.  
  1540.  
  1541. XX/* This code puts the keyboard into a form that we can use all */
  1542. XX/*  the keys as PF-keys as a vt100; i.e. disables the arrow notion */
  1543. XX/*  on the keypad. Keys will transmit standard SUN-2 keyboard codes.*/
  1544.  
  1545. XX#define        MAX_keydefs    (sizeof (k_board)/sizeof (*k_board))
  1546. XXint     fbdes,
  1547. XX        kb;
  1548.  
  1549.  
  1550.  
  1551. XXstruct fbtype   fb;
  1552. XXstruct key_id_num {
  1553. XX    char *name;
  1554. XX    int id_num;
  1555. XX    } k_board [] = {
  1556. XX    {"'", 87},
  1557. XX    {",", 107},
  1558. XX    {"-", 40},
  1559. XX    {".", 108},
  1560. XX    {"/", 109},
  1561. XX    {"0", 39},
  1562. XX    {"1", 30},
  1563. XX    {"2", 31},
  1564. XX    {"3", 32},
  1565. XX    {"4", 33},
  1566. XX    {"5", 34},
  1567. XX    {"6", 35},
  1568. XX    {"7", 36},
  1569. XX    {"8", 37},
  1570. XX    {"9", 38},
  1571. XX    {";", 86},
  1572. XX    {"=", 41},
  1573. XX    {"break", 19},
  1574. XX    {"bs", 43},
  1575. XX    {"del", 66},
  1576. XX    {"esc", 29},
  1577. XX    {"l1", 1},
  1578. XX    {"l10", 97},
  1579. XX    {"l2", 3},
  1580. XX    {"l3", 25},
  1581. XX    {"l4", 26},
  1582. XX    {"l5", 49},
  1583. XX    {"l6", 51},
  1584. XX    {"l7", 72},
  1585. XX    {"l8", 73},
  1586. XX    {"l9", 95},
  1587. XX    {"lf", 111},
  1588. XX    {"r1", 21},
  1589. XX    {"r10", 91},
  1590. XX    {"r11", 92},
  1591. XX    {"r12", 93},
  1592. XX    {"r13", 112},
  1593. XX    {"r14", 113},
  1594. XX    {"r15", 114},
  1595. XX    {"r2", 22},
  1596. XX    {"r3", 23},
  1597. XX    {"r4", 45},
  1598. XX    {"r5", 46},
  1599. XX    {"r6", 47},
  1600. XX    {"r7", 68},
  1601. XX    {"r8", 69},
  1602. XX    {"r9", 70},
  1603. XX    {"ret", 89},
  1604. XX    {"f1", 5},
  1605. XX    {"f2", 6},
  1606. XX    {"f3", 8},
  1607. XX    {"f4", 10},
  1608. XX    {"f5", 12},
  1609. XX    {"f6", 14},
  1610. XX    {"f7", 16},
  1611. XX    {"f8", 17},
  1612. XX    {"f9", 18},
  1613. XX    {"tab", 53},
  1614. XX    {"[", 64},
  1615. XX    {"\\", 88},
  1616. XX    {"]", 65},
  1617. XX    {"`", 42},
  1618. XX    {"a", 77},
  1619. XX    {"b", 104},
  1620. XX    {"c", 102},
  1621. XX    {"d", 79},
  1622. XX    {"e", 56},
  1623. XX    {"f", 80},
  1624. XX    {"g", 81},
  1625. XX    {"h", 82},
  1626. XX    {"i", 61},
  1627. XX    {"j", 83},
  1628. XX    {"k", 84},
  1629. XX    {"l", 85},
  1630. XX    {"m", 106},
  1631. XX    {"n", 105},
  1632. XX    {"o", 62},
  1633. XX    {"p", 63},
  1634. XX    {"q", 54},
  1635. XX    {"r", 57},
  1636. XX    {"s", 78},
  1637. XX    {"t", 58},
  1638. XX    {"u", 60},
  1639. XX    {"v", 103},
  1640. XX    {"w", 55},
  1641. XX    {"x", 101},
  1642. XX    {"y", 59},
  1643. XX    {"z", 100}
  1644. XX};
  1645. XX/* rf8,10,12,and 14 are the culprits. when the kbd is initialized */
  1646. XX/* they transmit an escape code instead of the standard sun-2 position*/
  1647. XXvoid
  1648. XXinit_kbd()
  1649. XX{
  1650. XX        prep_kbd ();    /* prepare keyboard */
  1651. XX        set_key("r8",RF(8));
  1652. XX        set_key("r10",RF(10));
  1653. XX        set_key("r12",RF(12));
  1654. XX        set_key("r14",RF(14));
  1655.  
  1656. XX}
  1657.  
  1658. XXint prep_kbd()
  1659. XX{
  1660. XX    if ((fbdes = open ("/dev/fb", 2)) < 0) {
  1661. XX    fprintf (stderr, "%s: couldn't open framebuffer\n", "ttyvt100");
  1662. XX    exit (2);
  1663. XX    }
  1664.  
  1665. XX    if (ioctl (fbdes, FBIOGTYPE, &fb) < 0) {
  1666. XX    fprintf (stderr, "%s: couldn't get the fb struct\n", "ttyvt100");
  1667. XX    exit (2);
  1668. XX    }
  1669.  
  1670. XX    if (fb.fb_type != FBTYPE_SUN2BW) {
  1671. XX    fprintf (stderr, "Sorry, I only do Sun2s\n", "ttyvt100");
  1672. XX    exit (2);
  1673. XX    }
  1674.  
  1675. XX    if ((kb = open ("/dev/kbd", 2)) < 0) {
  1676. XX    fprintf (stderr, "%s: couldn't open keyboard\n", "ttyvt100");
  1677. XX    exit (2);
  1678. XX    }
  1679. XX    return;
  1680. XX}
  1681.  
  1682. XXint set_key(key, keydef)
  1683. XXchar *key;
  1684. XXint keydef;
  1685. XX{
  1686. XX    int     found_key = FALSE,
  1687. XX            i;
  1688.  
  1689. XX    struct kiockey  this_key;
  1690. XX    struct kiockey *pk = &this_key;
  1691.  
  1692.  
  1693. XX    switch (*key) {
  1694. XX    case 'C': 
  1695. XX        pk -> kio_tablemask = CTRLMASK;
  1696. XX        key++;
  1697. XX        break;
  1698. XX    case 'S': 
  1699. XX        pk -> kio_tablemask = SHIFTMASK;
  1700. XX        key++;
  1701. XX        break;
  1702. XX    default: 
  1703. XX        pk -> kio_tablemask = 0;
  1704. XX        break;
  1705. XX    }
  1706.  
  1707.  
  1708. XX    for (i = 0; i < MAX_keydefs; i++) {
  1709. XX    if (strncmp (key, k_board[i].name, 3) == 0) {
  1710. XX        found_key = TRUE;
  1711. XX        break;
  1712. XX    }
  1713. XX    }
  1714.  
  1715. XX    if (!found_key) {
  1716. XX    fprintf (stderr, "%s: couldn't find `%s' key\n", "ttyvt100", key);
  1717. XX    exit (2);
  1718. XX    }
  1719.  
  1720. XX    pk -> kio_station = k_board[i].id_num;
  1721.  
  1722. XX/*    pk -> kio_tablemask = 0; */
  1723.  
  1724.  
  1725. XX            pk -> kio_entry = keydef;
  1726. XX        
  1727. XX 
  1728. XX/* define key */
  1729.  
  1730. XX    if (ioctl (kb, KIOCSETKEY, pk) < 0) {
  1731. XX    fprintf (stderr, "%s: couldn't define the `%s' key\n", "ttyvt100", key);
  1732. XX    exit (2);
  1733. XX    }
  1734. XX    return;
  1735. XX}
  1736. XX/* end of the keyboard stuff. only do this on entering. whew! */
  1737.  
  1738.  
  1739. @//E*O*F src/vt100keys.c//
  1740. chmod u=r,g=r,o=r src/vt100keys.c
  1741.  
  1742. echo x - MANIFEST
  1743. sed 's/^XX//' > "MANIFEST" <<'@//E*O*F MANIFEST//'
  1744. XXINSTALL                      1
  1745. XXMANIFEST                     1
  1746. XXMANIFEST                     9
  1747. XXdecode.sh                    1
  1748. XXfontdir                      1
  1749. XXfontdir/uu.gacha.b.8         1
  1750. XXfontdir/uu.gacha.bg.8        1
  1751. XXfontdir/uu.gacha.g.8         1
  1752. XXfontdir/uu.gacha.r.8         1
  1753. XXfontdir/uu.testfont.sh       1
  1754. XXfontdir/uu.thin.b.5          1
  1755. XXfontdir/uu.thin.b.6          1
  1756. XXfontdir/uu.thin.bg.5         2
  1757. XXfontdir/uu.thin.bg.6         2
  1758. XXfontdir/uu.thin.g.5          2
  1759. XXfontdir/uu.thin.g.6          2
  1760. XXfontdir/uu.thin.r.5          2
  1761. XXfontdir/uu.thin.r.6          2
  1762. XXfontdir/uu.thinbot.b.10      2
  1763. XXfontdir/uu.thinbot.bg.10     3
  1764. XXfontdir/uu.thinbot.g.10      3
  1765. XXfontdir/uu.thinbot.r.10      3
  1766. XXfontdir/uu.thintop.b.10      3
  1767. XXfontdir/uu.thintop.bg.10     3
  1768. XXfontdir/uu.thintop.g.10      3
  1769. XXfontdir/uu.thintop.r.10      4
  1770. XXfontdir/uu.thinwide.b.10     4
  1771. XXfontdir/uu.thinwide.bg.10     4
  1772. XXfontdir/uu.thinwide.g.10     4
  1773. XXfontdir/uu.thinwide.r.10     4
  1774. XXfontdir/uu.wide.b.16         4
  1775. XXfontdir/uu.wide.bg.16        5
  1776. XXfontdir/uu.wide.g.16         5
  1777. XXfontdir/uu.wide.r.16         5
  1778. XXfontdir/uu.widebot.b.16      5
  1779. XXfontdir/uu.widebot.bg.16     5
  1780. XXfontdir/uu.widebot.g.16      5
  1781. XXfontdir/uu.widebot.r.16      6
  1782. XXfontdir/uu.widetop.b.16      6
  1783. XXfontdir/uu.widetop.bg.16     6
  1784. XXfontdir/uu.widetop.g.16      6
  1785. XXfontdir/uu.widetop.r.16      6
  1786. XXlibdir                       1
  1787. XXlibdir/makefile              1
  1788. XXlibdir/uu.cim_change.o       6
  1789. XXlibdir/uu.cim_size.o         2
  1790. XXlibdir/uu.csr_change.o       7
  1791. XXlibdir/uu.csr_init.o         7
  1792. XXlibdir/uu.ttysw_main.o       7
  1793. XXlibdir/uu.ttyvt100.o         8
  1794. XXlibdir/uu.vt100fonts.o       7
  1795. XXlibdir/uu.vt100keys.o        8
  1796. XXmakefile                     1
  1797. XXsrc                          3
  1798. XXsrc/README                   6
  1799. XXsrc/ttyvt100.c               9
  1800. XXsrc/ttyvt100.h               8
  1801. XXsrc/vt100fonts.c             8
  1802. XXsrc/vt100keys.c              9
  1803. XXvconfig.h                    8
  1804. XXvshelltool.icon              6
  1805. XXvt100tool.1                  8
  1806. XXvt100tool.c                  10
  1807. @//E*O*F MANIFEST//
  1808. chmod u=rw,g=rw,o=rw MANIFEST
  1809.  
  1810. echo Inspecting for damage in transit...
  1811. temp=/tmp/sharin$$; dtemp=/tmp/sharout$$
  1812. trap "rm -f $temp $dtemp; exit" 0 1 2 3 15
  1813. cat > $temp <<\!!!
  1814.     1215    3746   27979 ttyvt100.c
  1815.      491    1239   10210 vt100keys.c
  1816.       63     126    1955 MANIFEST
  1817.     1769    5111   40144 total
  1818. !!!
  1819. wc  src/ttyvt100.c src/vt100keys.c MANIFEST | sed 's=[^ ]*/==' | diff -b $temp - >$dtemp
  1820. if test -s $dtemp
  1821. then echo "Ouch [diff of wc output]:" ; cat $dtemp
  1822. else echo "No problems found."
  1823. fi
  1824. exit 0
  1825.